extends layout

block css
  link(rel='stylesheet', href='/components/editor.md/css/editormd.preview.css')
  link(rel='shortcut icon', href='https://pandao.github.io/editor.md/favicon.ico', type='image/x-icon')
  style.
    .editormd-html-preview {
      width: 90%;
      margin: 0 auto;
    }

block content
  #datafield(style='display:none') #{post.content}
  include ./includes/view.jade

block scripts
  script(src='/components/editor.md/lib/marked.min.js')
  script(src='/components/editor.md/lib/prettify.min.js')
  script(src='/components/editor.md/lib/raphael.min.js')
  script(src='/components/editor.md/lib/underscore.min.js')
  script(src='/components/editor.md/lib/sequence-diagram.min.js')
  script(src='/components/editor.md/lib/flowchart.min.js')
  script(src='/components/editor.md/lib/jquery.flowchart.min.js')
  script(src='/components/editor.md/editormd.min.js')
  script(type='text/javascript').
    $(function () {
      var testEditormdView = editormd.markdownToHTML("test-editormd-view", {
        markdown: $("#datafield").text(),//+ "\\r\n" + $("#append-test").text(),
        htmlDecode : "style,script,iframe|on*",
        //toc             : false,
        tocm: true,    // Using [TOCM]
        //tocContainer    : "#custom-toc-container", // 自定义 ToC 容器层
        //gfm             : false,
        //tocDropdown     : true,
        // markdownSourceCode : true, // 是否保留 Markdown 源码，即是否删除保存源码的 Textarea 标签
        emoji: true,
        taskList: true,
        tex: true,  // 默认不解析
        flowChart: true,  // 默认不解析
        sequenceDiagram: true,  // 默认不解析
      });
    });
